<template>
  <a-modal
    :title="`洗衣类型${model ? '编辑' : '新增'}`"
    :width="640"
    :visible="visible"
    :confirmLoading="loading"
    @ok="handleOk"
    @cancel="handleCancel"
  >
    <a-spin :spinning="loading">
      <a-form :form="form" v-bind="formLayout">
        <a-form-item v-show="false" label="主键ID">
          <a-input v-decorator="['id']" disabled />
        </a-form-item>
        <a-form-item label="名称">
          <a-input v-decorator="['name']" placeholder="请填写名称" />
        </a-form-item>
        <a-form-item label="是否为奢侈品">
          <a-select v-decorator="['status']" placeholder="是否为奢侈品">
            <a-select-option :value="1">是</a-select-option>
            <a-select-option :value="0">否</a-select-option>
          </a-select>
        </a-form-item>
      </a-form>
    </a-spin>
  </a-modal>
</template>

<script>
import { getClothesKinds, clothesKindsAdd, clothesKindsEdit } from '@/api/clothes'
import formModalMixin from '@/mixins/formModalMixin'
// 表单字段
const fields = ['name', 'id', 'status']

export default {
  mixins: [formModalMixin],
  data () {
    this.fields = fields
    this.addAction = clothesKindsAdd
    this.editAction = clothesKindsEdit
    return {
      clothesKinds: []
    }
  },
  created () {
    getClothesKinds().then(res => {
      this.clothesKinds = res.data
    })
  }
}
</script>
